<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">大额投递管理</ui:define>
    <ui:define name="content">
        <h:form>
            <p:defaultCommand target="search"/>
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="right">
                        <p:commandButton id="search" value="查询" icon="fa fa-search"
                                         update="@form"/>
                        <p:commandButton value="重置" icon="fa fa-refresh"
                                         actionListener="#{largeNewDeliveryListBean.onReset()}"
                                         process="@this"
                                         update="@form"/>
                        <p:commandButton value="新建" icon="fa fa-plus"
                                         action="#{largeNewDeliveryListBean.toAdd()}"
                                         process="@this"/>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-fluid" style="padding-top: 30px;">
                <div class="ui-g">
                    <div class="ui-g-12">
                        <div class="card ui-g-12">
                            <div class="ui-g-12">
                                <h3>查询条件</h3>
                            </div>
                            <div class="ui-g-1 ui-sm-3">
                                <p:outputLabel value="甲方名称"/>
                            </div>
                            <div class="ui-g-3 ui-sm-3">
                                <p:selectOneMenu value="#{largeNewDeliveryListBean.$.type}"
                                                 filter="true" filterMatchMode="contains">
                                    <f:selectItem itemLabel="全部" itemValue=""/>
                                    <f:selectItems value="#{largeNewDeliveryListBean.loanWholeSaleCommentList}"
                                                   var="largeProduct"
                                                   itemLabel="#{largeProduct.ownername}"
                                                   itemValue="#{largeProduct.type}"/>
                                </p:selectOneMenu>
                            </div>

                            <div class="ui-g-1 ui-sm-3">
                                <p:outputLabel value="城市"/>
                            </div>
                            <div class="ui-g-3 ui-sm-3">
                                <p:selectOneMenu value="#{largeNewDeliveryListBean.$.city}"
                                                 filter="true" filterMatchMode="contains">
                                    <f:selectItem itemLabel="全部" itemValue=""/>
                                    <f:selectItem itemLabel="默认" itemValue="默认"/>
                                    <f:selectItems value="#{largeNewDeliveryListBean.commRegionNewInfoList}"
                                                   var="cityStr"
                                                   itemLabel="#{cityStr.name}"
                                                   itemValue="#{cityStr.name}"/>
                                </p:selectOneMenu>
                            </div>

                            <div class="ui-g-1 ui-sm-3">
                                <p:outputLabel value="投递优先级"/>
                            </div>
                            <div class="ui-g-3 ui-sm-3">
                                <p:inputText value="#{largeNewDeliveryListBean.$.sort}"/>
                            </div>
                        </div>
                        <div class="card">
                            <p:dataTable id="deliveryInfo"
                                         style="width: 100%"
                                         var="record"
                                         value="#{largeNewDeliveryListBean.lazyDataModel}"
                                         rows="#{constants:get('ROWS')}"
                                         lazy="true"
                                         paginator="true"
                                         paginatorTemplate="#{constants:get('PAGINATOR_TEMPLATE')}"
                                         rowsPerPageTemplate="#{constants:get('ROWS_PER_PAGE_TEMPLATE')}"
                                         emptyMessage="#{constants:get('EMPTY_MESSAGE')}"
                                         scrollable="true"
                                         reflow="true"
                                         resizableColumns="true">

                                <p:column headerText="操作" exportable="false">
                                    <p:splitButton icon="fa fa-eye"
                                                   action="#{largeNewDeliveryListBean.onView(record.id)}"
                                                   process="@this">
                                        <f:setPropertyActionListener value="/views/family/WholeSaleManage/largeNewDeliveryList.xhtml"
                                                                     target="#{currentUserBean.back}"/>

                                        <p:menuitem value="删除" icon="fa fa-times"
                                                    actionListener="#{largeNewDeliveryListBean.delete(record.id)}"
                                                    process="@this" update="@form"/>

                                    </p:splitButton>
                                </p:column>

                                <p:column headerText="城市">
                                    <h:outputText value="#{record.cityStr}"/>
                                </p:column>
                                <p:column headerText="甲方名称">
                                    <h:outputText value="#{record.largeTypeName}"/>
                                </p:column>
                                <p:column headerText="投递优先级">
                                    <h:outputText value="#{record.sort}"/>
                                </p:column>
                            </p:dataTable>
                        </div>
                    </div>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>
